/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package upgmadendro.graph;

import java.util.ArrayList;

/**
 *
 * @author Shadev
 */
public class Vertex {
    private String name=null;
    private ArrayList<Edge> edges=new ArrayList<Edge>();

    public Vertex(String name){
        this.name=name;
    }

    public Edge getEdgeToVertex(Vertex v){
        Edge res = null;
        for(Edge e : edges){
            if(e.getVertice()[0]==v||e.getVertice()[1]==v){
                res = e;
                break;
            }
        }
        return res;
    }

    /**
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @return the edges
     */
    public ArrayList<Edge> getEdges() {
        return edges;
    }

    /**
     * @param edges the edges to set
     */
    public void setEdges(ArrayList<Edge> edges) {
        this.edges = edges;
    }
}
